package com.gitee.absolute_spirit.hiot_android.data.source.network

import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
import javax.inject.Singleton

@Module
@InstallIn(SingletonComponent::class)
object DeviceNetworkModule {
    private const val BASE_URL = "http://10.0.2.2:8080"
    @Singleton
    @Provides
    fun provideService(): DeviceNetworkService {
        return Retrofit.Builder()
            .baseUrl(BASE_URL)
            .addConverterFactory(GsonConverterFactory.create())
            .build()
            .create(DeviceNetworkService::class.java)
    }
}

